
<template id="aj-grid">
	<div>
		<form action="?" method="GET" style="float:right;">
			<input type="hidden" name="searchField" value="content" />
			<input type="text" name="searchValue" placeholder="请输入搜索之关键字" class="aj-input" />
			<button style="margin-top: 0;" class="aj-btn">搜索</button>
		</form>
	    <table class="aj-grid ajaxjs-borderTable">
		    <thead>
		    	<tr>
					<th v-for="key in columns" @click="sortBy(key)" :class="{ active: sortKey == key }">
						{{ key | capitalize }}
						<span class="arrow" :class="sortOrders[key] > 0 ? 'asc' : 'dsc'"></span>
					</th>
			     </tr>
		      </thead>
		    <tbody>
		    	<tr v-for="entry in filteredData">
		              <td v-for="key in columns" v-html="entry[key]"></td>
		        </tr>
		    </tbody>
	    </table>
	</div>
</template>

<template id="aj-grid-inline-edit-row">
	<tr class="aj-grid-inline-edit-row" :class="{editing: isEditMode}">
		<td v-if="showCheckboxCol" class="selectCheckbox">
			<input type="checkbox" @change="selectCheckboxChange" :data-id="id" />
		</td>
		<td v-if="showIdCol">{{id}}</td>
		<td v-for="key in columns" :style="styleModifly" class="cell" @dblclick="dbEdit">
			<aj-cell-renderer v-if="!isEditMode" :html="renderCell(data, key)" :form="data"></aj-cell-renderer>
			<aj-cell-renderer v-if="isEditMode && key && key.editMode" :html="rendererEditMode(data, key)" :form="data"></aj-cell-renderer>
			<input type="text" v-if="canEdit(key)" size="0" v-model="data[key]" /> 
		</td>
		<td v-if="showControl" class="control">
			<aj-cell-renderer v-if="controlUi" :html="controlUi" :form="data"></aj-cell-renderer>
			<span @click="onEditClk"><img :src="ajResources.commonAsset + '/icon/update.gif'" /> 
			{{!isEditMode ? "编辑" : "确定"}}</span>
			<span @click="dele(id)"><img :src="ajResources.commonAsset + '/icon/delete.gif'" /> 删除</span> 
		</td>
	</tr>
</template> 

<template id="aj-grid-inline-edit-row-create">
	<tr class="aj-grid-inline-edit-row isEditMode"> 
		<td><input type="checkbox" /></td>
		<td></td>
		<td v-for="key in columns" style="padding:0" class="cell" @dblclick="dbEdit">
			<aj-select v-if="key != null && key.type == 'select'" :name="key.name" :options="key.data" style="width: 200px;"></aj-select>
			<input  v-if="key != null && !key.type" type="text" size="0" :name="key" /> 
		</td>
		<td class="control">
			<span @click="addNew"><img :src="ajResources.commonAsset + '/icon/update.gif'" />新增</span>
			<span @click="$parent.showAddNew = false"><img :src="ajResources.commonAsset + '/icon/delete.gif'" /> 撤销</span>
		</td>
	</tr>
</template>

<template id="aj-entity-toolbar">
	<div class="toolbar">
		<form v-if="search" class="right">
			<input type="text" name="keyword" placeholder="请输入关键字" size="12" />
			<button @click="doSearch"><i class="fa fa-search" style="color:#417BB5;"></i>搜索</button>
		</form>
		
		<aj-form-between-date v-if="betweenDate" class="right"></aj-form-between-date>
		
		<ul>
			<li v-if="create" @click="$emit('on-create-btn-clk')"><i class="fa fa-plus" style="color:#0a90f0;"></i> 新建</li>
			<li v-if="save" @click="$emit('on-save-btn-clk')"><i class="fa fa-floppy-o" style="color:rgb(205, 162, 4);"></i> 保存</li>
			<li v-if="deleBtn" @click="BUS.$emit('on-delete-btn-clk')"><i class="fa fa-trash-o" style="color:red;"></i> 删除</li>
			<li v-if="excel"><i class="fa fa-file-excel-o" style="color:green;"></i> 导出</li>
			<slot></slot>
		</ul>
	</div>
</template>